using Digitalmes.Common.ChannelQueues;
using Digitalmes.Infrastructure.Data;

namespace Digitalmes.Infrastructure.Extensions;

public static class DependencyInjections
{
    /// <summary>
    /// 注册基础设施服务。
    /// </summary>
    public static void AddInfrastructureSetup(this IHostBuilder builder)
    {
        builder.ConfigureServices((hostBuilder, services) =>
        {
            services.AddMemoryCache();
            services.AddSingleton(TimeProvider.System);

            // 注册基础服务
            services.AddUniqueIdGeneratorSetup(hostBuilder.Configuration);
            services.AddSqlSugarSetup(hostBuilder);
            services.AddMessageQueueSetup();
            services.AddIOSetup();
            services.AddFtpSetup(hostBuilder.Configuration);
            services.AddJobSetup(hostBuilder.Configuration);
        });
    }
}
